$webwork.htmlEncode($page.space.name) : 3 STRUTS Info
This page last changed on Oct 23, 2006 by cholmes.
This is some info on the STRUTS configuration web-app inside geoserver. We'll look at a few example pages to get an idea about whats happening. I highly recommend that you get a book on STRUTs (the "free" on-line documentation isnt that great). NOTE: The STRUTs code was written by people who didnt know STRUTs, so its not a good example of STRUTs programming. So, if you get confused or lost ITS NOT YOUR FAULT. STRUTs is basically just a Model-View-Controller. Model - This Java code that deals with getting and setting the Geoserver configuration details. In a nutshell, this is what happens when you go to a xyz.do page: 1. your web container will recognize the "*.do" URL and pass your request off to STRUTs.
The actual process is somewhat more difficult complex, and there's different modes etc... A simple example will help to clear this up. Get Geoserver running and go to config->data->style. This will be the http://localhost:8080/geoserver/config/data/style.do page.
This is a pretty simple page - lets look how STRUTs is used to make this page. We'll start off looking at the struts-config.xml file. In this you'll see the following: ... in global forwards .. <forward name="config.data.style" path="/config/data/style.do"/> ... in the action mappings ... <action path="/config/data/style" type="org.apache.struts.actions.ForwardAction" parameter="config.data.style"/> ... Inside the tiles-config.xml you'll see: ... <!-- styles --> <definition name="config.data.style" extends=".mainLayout"> <put name="key" value="config.data.style"/> <put name="body" value="/WEB-INF/pages/data/styles/Select.jsp"/> <put name="status" value="/WEB-INF/pages/data/status.jsp"/> <put name="layer" value="data"/> <put name="locationForwards" value="welcome:config:config.data"/> <put name="configActions" value="/WEB-INF/pages/configActions.jsp"/> <put name="menuForwards" value="config.data.style.new"/> </definition> ... At this point you're probably confused. This is because the original developers used "config.data.style", "/config/data/style", and "/config/data/style.do" in a way that really makes it impossible to understand whats going on. Also, there's indirect linkages in the .jsps. For example, a <html:form ...> element in Select.jsp will actually go and grab a Form object because the html form's action points to a .do (and therefore struts knows more about it). |
![]() |
Document generated by Confluence on Jan 16, 2008 23:26 |